package cn.smart.core.dto;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ApiResponse<T> {
    private T data;
    private String message;
    private int code;

    public static  <T> ApiResponse<T> success(T data) {
        return new ApiResponse<T>().setData(data).setMessage("成功").setCode(0);
    }
    public static <T> ApiResponse<T> error(int code ,String message) {
        return new ApiResponse<T>().setCode(code).setMessage(message);
    }
}
